package org.jsbd.boss.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IMarkImsiCountDAO;
import org.jsbd.boss.domian.statistics.MarkImsiCountBean;
import org.jsbd.boss.domian.statistics.MarkImsiCountVO;
import org.jsbd.boss.service.IMarkImsiCountService;
import org.springframework.stereotype.Service;

@Service("markImsiCountService")
public class MarkImsiCountServiceImpl implements IMarkImsiCountService {

	@Resource
	private IMarkImsiCountDAO markImsiCountDAO;

	@Override
	public Map<String, Object> findCurrentMonth(DataGridModel page, MarkImsiCountVO markImsiCountVO) {
		return markImsiCountDAO.findCurrentMonth(page, markImsiCountVO);
	}

	@Override
	public List<MarkImsiCountBean> getCurrentMonthDetail(MarkImsiCountVO markImsiCountVO) {
		List<Integer> counts =  markImsiCountDAO.getCurrentMonthCounts(markImsiCountVO);
		List<MarkImsiCountBean> list = new ArrayList<MarkImsiCountBean>();
		for (Integer count : counts) {
			markImsiCountVO.setCount(count);
			MarkImsiCountBean mcb = markImsiCountDAO.getCurrentMonthNum(markImsiCountVO);
			list.add(mcb);
		}
		return list;
	}

	@Override
	public Map<String, Object> findNextMonth(DataGridModel page, MarkImsiCountVO markImsiCountVO) {
		return markImsiCountDAO.findNextMonth(page, markImsiCountVO);
	}

	@Override
	public List<MarkImsiCountBean> getNextMonthDetail(MarkImsiCountVO markImsiCountVO) {
		List<Integer> counts =  markImsiCountDAO.getNextMonthCounts(markImsiCountVO);
		List<MarkImsiCountBean> list = new ArrayList<MarkImsiCountBean>();
		for (Integer count : counts) {
			markImsiCountVO.setCount(count);
			MarkImsiCountBean mcb = markImsiCountDAO.getNextMonthNum(markImsiCountVO);
			list.add(mcb);
		}
		return list;
	}

}
